﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mono.Cecil;

namespace Firecracker.Bootstrapper.Utils
{
  public static class TypeDefinitionExtensions
  {
    public static IEnumerable<TypeDefinition> GetInteritanceHierarchy(this TypeDefinition definition)
    {
      var current = (definition.BaseType != null) ? definition.BaseType.Resolve() : null; ;
      while (current != null)
      {
        yield return current;
        current = (current.BaseType != null) ? current.BaseType.Resolve() : null;
      }
    }

  }
}
